import 'package:flutter/material.dart';
import 'package:flutter_trip/widgets/common_image.dart';
import './index_recommend_data.dart';

var textStyle = TextStyle(fontSize: 14.0, fontWeight: FontWeight.w500);

class IndexRecommendItemWidget extends StatelessWidget {
  final IndexRecommendItem data;

  const IndexRecommendItemWidget(this.data, {Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    var width = MediaQuery.of(context).size.width / 2.3;
    return GestureDetector(
      onTap: (){
        Navigator.of(context).pushNamed(data.navigateUrl);
      },
      child: Container(
        width: width,
        height: 90,
         decoration: BoxDecoration(color: Colors.white),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceAround,
          children: [
            Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Text(data.title, style: textStyle,),
                Text(data.subTitle, style: textStyle,)
              ],
            ),
            CommonImage(data.imageUrl, width: 60.0,)
          ],
        ),
      ),
    );
  }
}